package KafkaSink

import bean.WaterSensor
import org.apache.flink.streaming.api.datastream.DataStreamSource
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment

/**
 *
 * @author Spring_Hu
 * @date 2021/10/10 21:09
 */
class Base {
  var env: StreamExecutionEnvironment = null
  var ds: DataStreamSource[Int] = null
  var ds01: DataStreamSource[WaterSensor] = null

  def run(op: => Unit) {
    try {
      env = StreamExecutionEnvironment.getExecutionEnvironment
      ds = env.fromElements(1, 2, 3, 4, 5, 6, 7, 8)
      ds01=env.fromElements(new WaterSensor("1",100,20),
        new WaterSensor("1",200,30),new WaterSensor("3",300,40))
      op
    } catch {
      case e: Exception => e.printStackTrace()
    } finally {
      env.execute("test")
    }
  }
}
